#!/usr/bin/php
<?php
// set up the Mongodb connection
$mongo = new Mongo();

// the database itself.
$db = $mongo->mugshots;

// the collection (nee table)
$collection = $db->shots;

// figure out the last docket ID fetched from site

$last = current(iterator_to_array($collection->find(array(), array("docket" => 1))->sort(array("arrest_date" => -1))->limit(1)));

printf("Starting catch-up from: %s\n", print_r($last['docket'], 1));

$id = $argv[1];

$url = "http://www.pcsoweb.com/InmateBooking/SubjectResults.aspx?id=$id";

$data = file_get_contents($url);

print($data);